In an image coding process, a quantity of information is generally reduced by lessening redundancy in spatial and temporal directions. To lessen the redundancy in the spatial direction, an intra-frame (intra) prediction coding process is applied. To lessen the redundancy in the temporal direction, an inter-frame (inter) prediction coding process is applied.
In the inter-frame prediction coding process, a coded picture located before or after, in display order, a current picture to be coded is used as a reference picture. Through motion estimation between the reference picture and the current picture, a motion vector is then derived. Next, motion compensation using the motion vector is performed to generate prediction image data. Subsequently, the prediction image data is subtracted from image data of the current picture, with the result that the redundancy in the temporal direction is removed.
In the motion estimation, values of difference between a current block to be coded in the current picture and blocks in the reference picture are calculated, and one of the blocks in the reference picture for which the difference value is smallest is determined as a reference block. Using the current block and the reference block, a motion vector is then estimated.
In the moving picture coding scheme called H. 264, which has already been standardized, three types of pictures: I-picture, P-picture, and B-picture, are used to reduce the quantity of information. For the I-picture, no inter-frame prediction coding process is performed. In other words, for the I-picture, only an intra-frame prediction coding process is performed.
For coding the P-picture and the B-picture, inter-frame prediction coding is applied. For coding the P-picture, one coded reference picture located before or after the current picture in display order is referred to. For coding the B-picture, two coded reference pictures located before or after the current picture in display order are referred to. From reference blocks included in these reference pictures, prediction image data is obtained.
The motion vector usually points to a reference block in a reference picture. When the reference block pointed to by the motion vector is outside the reference picture, no pixel value can be obtained unless treated. There is therefore a restriction that the motion vector points to a reference block within the reference picture. Alternatively, a pixel value is copied from inside to outside of the reference picture. By doing so, prediction image data is obtained from a reference block outside the reference picture. Copying a pixel value from inside to outside of a reference picture is also referred to as pixel stretching.
FIG. 35A is a conceptual diagram showing a prediction image generation process according to the related art. In FIG. 35A, a motion vector of a current block to be processed, included in a current picture to be processed, points to a reference block located on a boundary of the reference picture. In such a case, there is no pixel value at, in the reference block, a pixel position outside the range of the reference picture unless a stretching process is performed, resulting in a failure to obtain effective prediction image data.
FIG. 35B is a conceptual diagram showing pixel stretching according to the related art. In the reference block, a value of a pixel located inside the reference picture is copied to a pixel located outside the reference picture. By doing so, the pixel located outside is complemented with the value. Thus, effective prediction image data is obtained.
Patent Literature (PTL) 1 discloses a pixel stretching method.